package com.skq.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.groups.Default;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@Schema(description = "分类")
public class Category {
    @Schema(description = "分类ID")
    private Integer categoryId;//分类ID

    @NotNull(groups = Update.class)
    @Schema(description = "主键ID")
    private Integer id;//主键ID

    @NotBlank
    @Schema(description = "分类名称")
    private String categoryName;//分类名称

    @NotBlank
    @Schema(description = "分类别名")
    private String categoryAlias;//分类别名

    @Schema(description = "创建人ID")
    private Integer createUser;//创建人ID

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;//创建时间

    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;//更新时间

    //如果说某个校验项没有指定分组，默认属于Default分组
    //分组之间可以继承，A extends B ，那么A中拥有B中所有的校验项

    public interface Add extends Default {
    }

    public interface Update extends Default {
    }
}
